/**
 * 学习目标：索引访问类型
 * 语法：类型[键名]
 * 作用：查询某个键的类型
 */

type Person = {
  name: string;
  age: number;
  gender: '男' | '女'；
};

const name1: Person['name'] = 'zs';
const age: Person['age'] = 18;
const nameOrAge: Person['name' | 'age'] = 19;

const all: Person[keyof Person] = [];